package cn.jnetty.remoting.code;


/**
 * @author:猪哥亮
 * @创建时间:2019/3/15.
 * @文件描述:
 */

public class JnettyTcpWrapperIoMessage {
    private int rpcId;
    /**请求类型*/
    private short module;
    /**状态码 成功、失败*/
    private byte cmd;
    /**状态码（成功失败）、消息类型（主动通知、请求返回）*/
    private byte status;
    private byte[] msg;

    public JnettyTcpWrapperIoMessage() {
    }

    public JnettyTcpWrapperIoMessage(short module, byte cmd, byte status, byte[] msg) {
        this.module = module;
        this.cmd = cmd;
        this.status = status;
        this.msg = msg;
    }

    public JnettyTcpWrapperIoMessage(int rpcId,short module, byte cmd, byte[] msg) {
        this.rpcId = rpcId;
        this.module = module;
        this.cmd = cmd;
        this.msg = msg;
    }
    public int length(){
        return this.msg == null ? 0 : this.msg.length;
    }

    public short getModule() {
        return module;
    }

    public void setModule(short module) {
        this.module = module;
    }

    public byte getCmd() {
        return cmd;
    }

    public void setCmd(byte cmd) {
        this.cmd = cmd;
    }

    public byte getStatus() {
        return status;
    }

    public void setStatus(byte status) {
        this.status = status;
    }

    public byte[] getMsg() {
        return msg;
    }

    public void setMsg(byte[] msg) {
        this.msg = msg;
    }

    public int getRpcId() {
        return rpcId;
    }

    public void setRpcId(int rpcId) {
        this.rpcId = rpcId;
    }
}
